package com.qzf.test.utils;

import javazoom.jl.decoder.JavaLayerException;
import javazoom.jl.player.Player;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;

public class PlayerUtils {
    private static PlayerUtils playerUtils;
    private PlayerUtils(){
    }
    public  static PlayerUtils getInstance(){
        if (playerUtils==null){
            playerUtils=new PlayerUtils();
        }
        return playerUtils;
    }

    public void play(){
        try {
            InputStream is = new FileInputStream("music/music.mp3");

            Player p=new Player(is);
            p.play();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (JavaLayerException e) {
            e.printStackTrace();
        }
    }
}
